package com.flython.aems.management.component;

import com.flython.aems.management.model.UniqueParam;
import com.flython.aems.management.repo.UniqueRepo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class UniqueParamSupplier extends AbstractParamsSupplier<UniqueParam> {

    @Autowired
    UniqueRepo uniqueRepo;

    public UniqueParamSupplier(int priority) {
        super(priority);
    }

    @Override
    public Map<String, UniqueParam> selectByNeId(Long neId) {
        List<UniqueParam> csonParams = uniqueRepo.findByNeId(neId);
        HashMap<String, UniqueParam> map = new HashMap<>();
        csonParams.forEach(p-> map.put(p.getName(),p));
        return map;
    }
}
